package com.smile.service.entity.device.manager;

import com.alibaba.fastjson2.annotation.JSONField;

public class TopologyOperationResult {

    @JSONField(name = "result")
    private int resultCode;  // 操作结果码

    // Getter & Setter
    public int getResultCode() {
        return resultCode;
    }

    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }

    // 实用方法 - 判断操作是否成功 (0表示成功)
    public boolean isSuccess() {
        return resultCode == 0;
    }

    // 实用方法 - 获取操作结果描述
    public String getResultDescription() {
        switch (resultCode) {
            case 0:
                return "操作成功";
            case 1:
                return "操作失败";
            case 2:
                return "操作超时";
            default:
                return "操作错误: " + resultCode;
        }
    }

    @Override
    public String toString() {
        return "TopologyOperationResult{" +
                "resultCode=" + resultCode +
                " (" + getResultDescription() + ")" +
                '}';
    }
}